<include file="Common:minheader" />
<!-- /. NAV SIDE  -->
<form class="layui-form" action="" id="cheform" >
	<input type="hidden" name="id" value="{$usersAddressInfo.id}">
	<input type="hidden" name="uid" value="{$usersAddressInfo.uid}">
	<div class="layui-form-item">
		<label class="layui-form-label">联系人</label>
		<div class="layui-input-block">
			<input type="text" name="name" required  lay-verify="required" placeholder="请输入联系人" autocomplete="off" class="layui-input" value="{$usersAddressInfo.name}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">手机</label>
		<div class="layui-input-block">
			<input type="text" name="mobile" required  lay-verify="required" placeholder="请输入联系人手机" autocomplete="off" class="layui-input" value="{$usersAddressInfo.mobile}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">地址</label>
		<div class="layui-input-block">
			<input type="text" name="address" required  lay-verify="required" placeholder="请输入地址" autocomplete="off" class="layui-input" value="{$usersAddressInfo.address}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">默认地址</label>
		<div class="layui-input-block">
		  <input type="radio" name="default" value="1" title="是" <if condition="$usersAddressInfo.default eq 1">checked</if>>
		  <input type="radio" name="default" value="0" title="否" <if condition="$usersAddressInfo.default eq 0">checked</if>>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">状态</label>
		<div class="layui-input-block">
		  <input type="radio" name="status" value="1" title="是" <if condition="$usersAddressInfo.status eq 1">checked</if>>
		  <input type="radio" name="status" value="0" title="否" <if condition="$usersAddressInfo.status eq 0">checked</if>>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
		  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
		  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
<script>
	layui.use('form', function(){
		var form = layui.form;
		form.on('submit(formDemo)', function(data){
			var cont = $('#cheform').serialize();
			$.ajax({
				url:"{:U('Users/editUsersAddress')}",
				type:'post',
				dataType:'json',
				data:cont,
				success:function(data){
					if(data.code==0){
						layer.alert(data.message);
					}else{
						layer.alert(data.message, function(index){
							//do something
							window.parent.location.reload();
							var index = parent.layer.getFrameIndex(window.name); 
							parent.layer.close(index);
						});
					}
				}
			});
			//layer.msg(JSON.stringify(data.field));
			return false;
		});
	});
</script>
<!-- /. PAGE INNER  -->
<include file="Common:footer" />
    